package com.geek.javase.ch17.work;

import java.io.PrintWriter;
import java.net.Socket;

/*
 *@author wangpeng
 *2025/11/3 17:06
 *@description TODO
 */
public class TCPClient {
    public static void main(String[] args) {
        Socket socket = null;
        PrintWriter out = null;
        try{
            //socket = new Socket("192.168.0.152", 8899);
            socket = new Socket("192.168.0.219", 8888);
            System.out.println("客服端正常启动！");
            out = new PrintWriter(socket.getOutputStream());
            out.println("你好，我是王鹏");
            out.flush();

        }catch(Exception e){
            e.printStackTrace();
        }finally {
            if(socket != null){
                try{
                    socket.close();
                }catch(Exception e){
                    e.printStackTrace();
                }
            }
        }
    }
}
